package com.asj.house.controller;


import com.asj.house.entity.HouseNotice;
import com.asj.house.returns.RespEntity;
import com.asj.house.service.HouseNoticeService;
import com.asj.house.vo.param.NoticeParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 公告表 前端控制器
 * </p>
 *
 * @author asj
 * @since 2021-03-16
 */
@RestController
@RequestMapping("/house-notice")
@Slf4j
@Api(value = "公告管理", tags = "公告管理")
public class HouseNoticeController {

    @Resource
    private HouseNoticeService houseNoticeService;

    @GetMapping("/list")
    @ApiOperation(value = "公告列表")
    public RespEntity<List<HouseNotice>> noticeList() {
        RespEntity<List<HouseNotice>> respEntity = houseNoticeService.noticeList();
        return respEntity;
    }

    @PostMapping("/insert")
    @ApiOperation(value = "发布公告")
    public RespEntity insertNotice(@RequestBody NoticeParam noticeParam) {
        RespEntity respEntity = houseNoticeService.insertNotice(noticeParam);
        return respEntity;
    }
}
